$(document).ready(function() {
    
    $("#tag_category").select2();
    $("#tag_subcategory").select2();
    
    // auto complete
    /*$("#prp_typename_lang_id").select2({
            placeholder: "Select Language"
    });
    $("#prp_sub_tag_lang_id").select2({
            placeholder: "Select Language"
    });
  
    $("#prp_tgtype_lang_id").select2({
            placeholder: "Select Language"
    });
    
    $("#prp_tgtype_sub_tag").select2({
            placeholder: "Select Subcategory"
    });
    
    
    $("#prp_tgtype_type").select2({
            placeholder: "Select Category"
    });*/
    
    
     
    $('#tag_category').change(function() {
         //var lang_id = $(this).attr('lang_id');
         var postdata = {};
      //  $("#prp_tgtype_sub_tag").select2("val", "");

        var category_id = $(this).val();
        if (category_id === '') {
        } else {
            postdata['category_id'] = category_id;
            $("#tag_subcategory").select2("val", "");

            jQuery.post(BASE_PATH + '/tagtype/getsubcategory', postdata, function(result) {
                $('#tag_subcategory').html(result);
            });
            
        }

    });
    
    
    
    
    
    
    $('#prp_tgtype_type').change(function() {
         //var lang_id = $(this).attr('lang_id');
         var postdata = {};
      //  $("#prp_tgtype_sub_tag").select2("val", "");

        var category_id = $(this).val();
        if (category_id === '') {
        } else {
            postdata['category_id'] = category_id;
            jQuery.post(BASE_PATH + '/tagtype/getsubcategory', postdata, function(result) {
                $('#prp_tgtype_sub_tag').html(result);
            });
            
        }

    });
    
   
   
    
     
});
	 